<?php
//首先判断是不是登录了
session_start();
if(!isset($_SESSION['loggedUsername']) || !$_SESSION['loggedUsername']){
    echo "<script>alert('请登录后访问本页面');location.href='index.php';</script>";
    exit;
}
?>